Perpendicular magnetic recording (PMR) techniques may enable higher recording densities on magnetic storage media than conventional longitudinal magnetic recording techniques. PMR systems include heads that record bits perpendicular to the plane of the disk. PMR disks include a high permeability (“soft”) magnetic underlayer between a perpendicularly magnetized thin film data storage layer and the substrate. An image of the magnetic head pole created by the head is produced in the magnetically soft underlayer. Consequently, the storage layer is effectively in the gap of the recording head, where the magnetic recording field is larger than the fringing field produced by a longitudinal magnetic recording (LMR) head. The larger recording field makes it possible to record using smaller grain sizes and smaller bit sizes than in LMR systems. In PMR, the channel response has a DC component. For a channel that is AC-coupled to the preamplifier and read channel, or that contains some other means for high-pass filtering the channel response, there may be DC-distortion. The DC-distortion may manifest itself as a data dependent baseline wander, which can severely affect the performance of a system that equalizes the channel response to a response target that is not DC-free. cl SUMMARY 
In an embodiment, a perpendicular magnetic recording (PMR) system may scramble an input data sequence with a first scramble seed and encode the scrambled data sequence with a modulation encoder (e.g., a run length limited (RLL) encoder). The system may then determine whether the scrambled and encoded data sequence includes one or more patterns associated with large baseline wander, using, e.g., the running digital sum (RDS) over the sequence or a low pass filter as a metric. If such a pattern is detected, the system may control the scrambler to re-scramble the data sequence with another scrambler seed, encode the re-scrambled sequence, and determine whether this scrambled and encoded sequence includes on or more patterns associated with large baseline wander. This process may be repeated until a scrambled and encoded sequence without such patterns is generated, or until all available scrambler seeds are exhausted, in which case, the scrambler seed with the least amount of baseline wander may be used. The best scrambled and decoded sequence may then be written to the magnetic recording medium.
In an alternative embodiment, a PMR system may scramble an input data sequence with a first scramble seed and encode the scrambled data sequence with a modulation encoder (e.g., a run length limited (RLL) encoder). A write signal may be generated and the encoded data sequence written to the magnetic recording medium. The write signal may also be fed back to a read channel in the system. The write signal may be passed through a filter to mimic the magnetic recording channel. The read channel may then determine if DC-wander in the write signal is too large to be accurately decoded, or otherwise fails to meet a predetermined criterion as described below. If so, the data sequence may be scrambled with another scramble seed, encoded, and used to over-write the first encoded data sequence in the magnetic recording medium. This process may be repeated until an encoded data sequence that can be accurately decoded by the read channel is generated.
For both of the alternative embodiments described above, the data sequence may not be scrambled in the first run through the system.